/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"67FA3282-5FD3-4759-9F71-62CFF7D6DC6A"}
 */
function volver(event) {
	globals.mostrarForm("viajes_consulta_copy");
}

/**
 * Handle record selected.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"64970C10-C028-432A-A4C2-2EE9581109D7"}
 */
function onRecordSelection(event) {
	// permite cambio del cliente si no ha sido facturado
	if (estado_fac != 1)
		elements.cliente_id.editable = false
	else
		elements.cliente_id.editable = true
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"E59EA384-443F-4788-B147-EF552827E68B"}
 */
function onShow(firstShow, event) {
	databaseManager.setAutoSave(true)
}

/**
 * Handle hide window.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"3BD5F0DF-CF90-4E16-8AD6-ECCF9236F9E0"}
 */
function onHide(event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	return true
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"257BADF7-C263-4B1D-B461-218E33D60A9E"}
 */
function actualizar(event) {
	var suceso = databaseManager.saveData()
	if (suceso == false)
	{
		globals.DIALOGS.showWarningDialog('Aviso','Error al actualizar la información','OK')
		databaseManager.revertEditedRecords()	
	}
	else
	{
		globals.DIALOGS.showInfoDialog('Aviso','Información actualizada','OK')
	}
}
